package com.example.course.controller;

import com.example.course.bean.School;
import com.example.course.service.SchoolService;
import com.example.course.vo.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


import javax.annotation.Resource;

@Controller
public class SchoolController {
    @Resource
    private SchoolService schoolService;

    @RequestMapping("/course/showSchool")
    @ResponseBody
    public Result showSchool(){
        return new Result(schoolService.getSchool(1));
    }

    @RequestMapping("/course/updateSchool")
    @ResponseBody
    public Result updateSchool(School school){
        int i = schoolService.updateSchool(school);
        if(i == 0){
            return Result.fail();
        }else {
            return Result.success();
        }
    }
}
